Skip to content

Instantly share code, notes, and snippets.

View gsamat's full-sized avatar

Samat Galimov gsamat

View GitHub Profile
#!/bin/sh
# CONFIGURATION
# 1. Go to @botfather and create a bot and use it's auth token as bot_token value
# 2. Create test channel, believe me, you need it
# 3. Set some url for your test channel
# 4. Add your bot to both channels, set their names in variables
# USAGE
# 1. Copy your markdown-formatted message into OS clipboard (Cmd+C)
  1. заходим в news feed preferences

  2. Unfollow

  3. Скроллим до упора вниз

  4. Выполняем в консоли

var a = document.querySelectorAll('[aria-label$="Following"]');
@gsamat
gsamat / gist:a970d34dbdfdbedb2b04
Last active February 10, 2016 08:39
parse html facebook names
egrep -o 'https://www.facebook.com/profile.php\?id=[0-9]*' page.html | sort -u > numbers.txt
egrep -o 'https://www.facebook.com/[a-z\._]*\?fref' page.html | sort -u > logins.txt
@gsamat
gsamat / keybase.md
Created February 5, 2016 16:16
keybase.md

Keybase proof

I hereby claim:

  • I am gsamat on github.
  • I am samat (https://keybase.io/samat) on keybase.
  • I have a public key whose fingerprint is 7A02 13AE B4A7 C671 9490 0978 D074 5471 F28C D69D

To claim this, I am signing this object:

@gsamat
gsamat / download.sh
Last active September 29, 2015 17:35
slack private group to channel import
#!/bin/sh
# 0. create a channel you want to import to
# 1. first you get token and channel_id from slack's API page
# 2. then you run the script
# 3. while it is running, you export your team data, delete everything except one channels.json, users.json and one dir for you channel
# 4. then manually (sorry guys) craft json and put it into channel dir
# 5. make zip and upload it to import
# 6. profit
token=
channel_id=
@gsamat
gsamat / enable-internet.sh
Last active August 29, 2015 14:08
Keep my Kerala internet alive
#!/bin/sh
# start it with "caffeinate ./enable-internet.sh", if you want to prevent your Macbook from sleeping
# do not forget "chmod +x ./enable-internet.sh"
# put your username and password below
username=
password=
count=1
while true
do
#curl --trace-ascii - -d 'redirurl=%24PORTAL_REDIRURL%24&auth_user=$username&auth_pass=$password&accept=Login+%3E%3E' https://mwcp-spg-01a.adlkerala.com:8003/index.php
Application -> Build Phases -> Link Binary with Libraries -> Add QTKit.framework
add header to AppDelegate.h
#import <QTKit/QTKit.h>
# in AppDelegate.h
@property (strong) QTMovie *movie;
@gsamat
gsamat / gist:5252674
Last active December 15, 2015 11:28
shell + awk + bc to measure speed of transaction
echo "`{du -s /mnt/z2911kj6/pg&&sleep 10&&du -s /mnt/z2911kj6/pg}|awk 'NR==1 {a=$1;}; NR==2 {print $1-a};'`*512/1024/1024" | bc
@gsamat
gsamat / gist:5164942
Created March 14, 2013 20:30
Питание Митьков
Правда, я слышал об одном митьке, который затрачивал сравнительно долгое время на приготовление пищи, зато он делал это впрок, на месяц вперед. Этот митёк покупал 3 кг зельца (копеек за 30 за кг), 4 буханки хлеба, две пачки маргарина для сытности, тщательно перемешивал эти продукты в тазу, варил и закатывал в десятилитровую бутыль. Таким образом, питание на месяц обходилось ему примерно в 3 рубля плюс большая экономия времени.
@gsamat
gsamat / readings.js
Created February 12, 2013 10:30
Find out all reading per hour in Bookmates mongo activity database using map-reduce. Old mongo, no aggregates :(
conn = new Mongo();
db = conn.getDB("publisher_bookmate");
db.getMongo().setSlaveOk();
var mapFunction1 = function() {
emit(this.read_at, this.size);
};
var reduceFunction1 = function(keyCustId, readcount) {
return Array.sum(readcount);
};
res= db.getCollection("stats.reading_hourlies").mapReduce(