Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View adw0rd's full-sized avatar
:octocat:
I may be slow to respond.

Mikhail Andreev adw0rd

:octocat:
I may be slow to respond.
View GitHub Profile
@lorenzodifuccia
lorenzodifuccia / generate_instagram_enc_password.py
Created December 22, 2020 02:12
Encryption function used by Instagram (Browser App) to generate the 'enc_password' from PubKey (AES-GCM + SealedBox)
import base64
import struct
import datetime
import binascii
from urllib.parse import quote_plus
# pip install pycryptodomex
from Cryptodome import Random
from Cryptodome.Cipher import AES
@tikseniia
tikseniia / get-posts.py
Created February 4, 2019 23:50
Get Instagram posts for tag
import requests
import time
import json
arr = []
end_cursor = '' # empty for the 1st page
tag = 'russia' # your tag
page_count = 5 # desired number of pages
for i in range(0, page_count):
url = "https://www.instagram.com/explore/tags/{0}/?__a=1&max_id={1}".format(tag, end_cursor)
r = requests.get(url)
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@yannickl
yannickl / YLColor.swift
Last active September 16, 2023 03:55
Hex string <=> UIColor conversion in Swift
import Foundation
import UIKit
extension UIColor {
convenience init(hexString:String) {
let hexString:NSString = hexString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
let scanner = NSScanner(string: hexString)
if (hexString.hasPrefix("#")) {
scanner.scanLocation = 1
@marcelog
marcelog / logstashUDP.js
Last active April 12, 2018 20:19
quick UDP Logstash logging from nodejs
var util = require('util');
var dgram = require('dgram');
function logstashUDP(host, port, type, message, fields, callback) {
var client = dgram.createSocket('udp4');
var logObject = {
'@timestamp': (new Date).toISOString(),
type: type,
message: message,
fields: fields
-module(web_lager_handler).
-behaviour(gen_event).
-export([subscribe/1, unsubscribe/1]).
-export([init/1, handle_call/2, handle_event/2, handle_info/2, terminate/2,
code_change/3]).
-export([remover_loop/0]).
@ogrrd
ogrrd / dnsmasq OS X.md
Last active April 16, 2024 20:28
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

-module(json_parser).
-export([decode_api/1]).
-record(api, {
status,
message,
timeout
}).
-record(api1, {
@diyan
diyan / choosing_http_mock_library.md
Created December 18, 2012 12:04
Choosing HTTP mock library
@avoine
avoine / gist:2912777
Created June 11, 2012 21:19
Bridge to send rsyslog logs to sentry (http://www.getsentry.com)
#!/usr/bin/env python
#
# Copyright 2012 Patrick Hetu <patrick.hetu@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,