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
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';
@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
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
-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
@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;
jsdoc -c jsdoc.conf.json -d [DIR_OF_DOC]
@progress44
progress44 / _service.md
Created March 28, 2017 14:41 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@progress44
progress44 / install.sh
Created June 8, 2017 07:35
Installs an ipa file to an ios device
#!/bin/sh
# Install an app to device
ideviceinstaller -i dist/xx.ipa
@progress44
progress44 / PackageApplication
Last active June 8, 2017 09:13
PackageApplication script from Xcode 8.2.1
#!/usr/bin/perl
#
# PackageApplication
#
# Copyright (c) 2009-2012 Apple Inc. All rights reserved.
#
# Package an iPhone Application into an .ipa wrapper
#
use Pod::Usage;
@progress44
progress44 / sslrenewal
Created June 26, 2017 14:00 — forked from kopiro/sslrenewal
SSL Renewal with LE using same CSR
#!/bin/bash
CONTAINER="/var/www/html"
DOMAIN="kopiro.it"
PUBLIC_DIR="$CONTAINER/public"
BACKUP_DIR="$CONTAINER/conf/backup/$(date +%s)"
mkdir -p "$BACKUP_DIR"
cp -v $CONTAINER/conf/*.pem "$BACKUP_DIR/"