Skip to content

Instantly share code, notes, and snippets.

View rahogata's full-sized avatar

Shivakumar K R rahogata

View GitHub Profile
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active November 9, 2024 08:57
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@shuson
shuson / sample.js
Last active September 19, 2023 08:50
get base64 raw data of image from responseBody using jquery ajax
$.ajax({
type: "GET",
url: "imageURL",
beforeSend: function (xhr) {
xhr.overrideMimeType('text/plain; charset=x-user-defined');
},
success: function (result, textStatus, jqXHR) {
if(result.length < 1){
alert("The thumbnail doesn't exist");
$("#thumbnail").attr("src", "data:image/png;base64,");
@imranity
imranity / gist:9246dd195f785cf4783d
Created February 13, 2015 22:38
How to solve "sudo: no tty present and no askpass program specified" when trying to run a shell from Jenkins
Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along
Simple steps:
1. On ubuntu based systems, run " $ sudo visudo "
2. this will open /etc/sudoers file.
3. If your jenkins user is already in that file, then modify to look like this:
jenkins ALL=(ALL) NOPASSWD: ALL
4. save the file by doing Ctrl+O (dont save in tmp file. save in /etc/sudoers, confirm overwrite)
5. Exit by doing Ctrl+X
6. Relaunch your jenkins job
@hacklschorsch
hacklschorsch / FileChangeNotifier.java
Last active July 15, 2019 22:12
Java observable that notifies on changes to a File using Java 7 NIO and a separate thread.
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.util.Observable;
import static java.nio.file.StandardWatchEventKinds.*;
/**
* FileChangeNotifier notifies its observers when @file has changed.
* It uses Java 7 NIO and runs in a separate thread (since the NIO call blocks).
@Zidanela
Zidanela / LdapClient.java
Created April 25, 2016 07:05
Example: How get user info from LDAP
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
import javax.xml.registry.infomodel.User;
import java.io.FileOutputStream;
@dcollien
dcollien / multipart.js
Last active July 17, 2024 03:47
Parse multi-part formdata in the browser
var Multipart = {
parse: (function() {
function Parser(arraybuf, boundary) {
this.array = arraybuf;
this.token = null;
this.current = null;
this.i = 0;
this.boundary = boundary;
}
@fjunior87
fjunior87 / WSo2 Download
Last active April 24, 2023 07:59
WGET Command Download WSO2 Products
API MGR
wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/api-manager/2.1.0/wso2am-2.1.0.zip
API-MGR-ANALYTICS
wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/api-manager/2.1.0/wso2am-analytics-2.1.0.zip
ESB
wget --user-agent="testuser" --referer="http://connect.wso2.com/wso2/getform/reg/new_product_download" http://dist.wso2.org/products/enterprise-integrator/6.1.1/wso2ei-6.1.1.zip
@Godofbrowser
Godofbrowser / axios.refresh_token.1.js
Last active November 10, 2024 14:36 — forked from culttm/axios.refresh_token.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
@jbaranski
jbaranski / LiquibaseCompositePrimaryKey.md
Created August 1, 2020 14:43
Liquibase Composite Primary Key

Here are two examples of how to define a composite primary key for some table using Liquibase.

  • Add the composite primary key up front during table construction (preferred).
  <changeSet id="1">
    <createTable tableName="some_table">
      <column name="id_1" type="varchar_ignorecase">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_SOME_TABLE"></constraints>
 
@opastorello
opastorello / sublime text 4143 license key
Last active November 9, 2024 11:02
sublime text 4143 license key
> * Go to [hexed.it](https://hexed.it/)
> * Click "Open File" and choose your sublime_text.exe **(DON'T FORGET TO BACKUP YOUR EXE FILE)**
> * Go to Search and in "Search for" put: 80 78 05 00 0F 94 C1
> * In Search Type select "Enable replace" and put: 80 78 05 00 0F 94 C1
> * Click "Find next" then "Replace"
> * Do the same thing with: C6 40 05 01 48 85 C9 => C6 40 05 01 48 85 C9
> * Click "Save as" then name it: sublime_text
> * Copy your modified sublime_text.exe to directory Sublime Text