Skip to content

Instantly share code, notes, and snippets.

View progress44's full-sized avatar
Drinking coffee

Ani Sinanaj progress44

Drinking coffee
View GitHub Profile
jsdoc -c jsdoc.conf.json -d [DIR_OF_DOC]
@progress44
progress44 / levenshtein.sql
Created October 4, 2016 08:27
Calculating Levenshtein distance directly in MySQL
DELIMITER $$
CREATE FUNCTION levenshtein( s1 VARCHAR(255), s2 VARCHAR(255) )
RETURNS INT
DETERMINISTIC
BEGIN
DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT;
DECLARE s1_char CHAR;
-- max strlen=255
DECLARE cv0, cv1 VARBINARY(256);
SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0;
-injars /opt/android/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar
-outjars google-play-services-light.jar
-libraryjars /opt/android/extras/android/support/v4/android-support-v4.jar
-libraryjars /opt/android/extras/android/support/v7/mediarouter/libs/android-support-v7-mediarouter.jar
-libraryjars /opt/android/platforms/android-23/android.jar
-libraryjars /opt/android/platforms/android-10/android.jar
-dontoptimize
-dontobfuscate
if (senderId != null) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
String token = getToken(senderId);
GcmPubSub.getInstance(TiApplication.getInstance()).subscribe(token, topic, null);
if (successTopicCallback != null) {
// send success callback
@progress44
progress44 / auth.ssh
Created August 4, 2016 20:09
Make a mysql dump and back it up on a different server
#!/bin/bash
# Server credentials
$account=""
$server2=""
$remote=""
# Create ssh key
# So, basically, run `ssh-keygen -t dsa` on the machine that will run your script.
# When it asks you for a passphrase, hit ENTER to accept a blank. You will get two files.
# If you followed the default suggestions, the files will be ~/.ssh/id_dsa
SELECT concat('alter table ',table_schema,'.',table_name,' DROP FOREIGN KEY ',constraint_name,';')
FROM information_schema.table_constraints
WHERE constraint_type='FOREIGN KEY'
AND table_schema='cm_demo_myIsam';