Skip to content

Instantly share code, notes, and snippets.

View sepgh's full-sized avatar
🐣
Poking the part of my brain that loves to learn C

Sepehr Gh sepgh

🐣
Poking the part of my brain that loves to learn C
  • Tehran
View GitHub Profile
@sepgh
sepgh / potranslate.py
Last active December 11, 2023 15:38
A Django command to automatically add translations to po files
import json
import requests
from django.core.management.base import BaseCommand
from os.path import exists
import polib
class Command(BaseCommand):
"""
Complete missing and fuzzy translations of po files
@sepgh
sepgh / crypt.py
Created September 14, 2021 06:38
Python AES
import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
class AESCipher(object):
def __init__(self, key):
self.bs = AES.block_size
@sepgh
sepgh / KademliaNodesToReference.java
Last active September 14, 2021 06:41
Kademlia way to choose nodes using xor distance
import java.util.ArrayList;
import java.util.Arrays;
public class KademliaNodesToReference {
public static void main(String[] args) {
// Node identifier size
int identifierSize = 128;
// Valid distances according to identifier size
ArrayList<Integer> distances = new ArrayList<>();
@sepgh
sepgh / init.sh
Last active August 25, 2021 07:00
My system init!
#!/bin/sh
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install -y gettext maven git screen openjdk-8-jdk xclip proxychains proxychains4 privoxy tor torsocks net-tools gcc g++ make curl xorg openbox xauth gimp -y
##Node
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
@sepgh
sepgh / log4j2-tomcat.xml
Created June 8, 2020 05:07
Tomcat log4j2
<Configuration status="error">
<Properties>
<Property name="logdir">${sys:catalina.base}/logs</Property>
<Property name="layout">TOMCAT %d [%t] %-5p %c- %m%n</Property>
</Properties>
<Appenders>
<RollingFile name="CATALINA" fileName="${logdir}/catalina.log" filePattern="${logdir}/catalina.%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="${layout}"/>
<Policies>
<TimeBasedTriggeringPolicy />
@sepgh
sepgh / Spotify crack.md
Created May 10, 2020 04:38
Spotify crack no ads
  • Mac: "/private/etc/hosts"
  • Windows: "C:\Windows\System32\drivers\etc\hosts"
0.0.0.0 adclick.g.doublecklick.net
0.0.0.0 adeventtracker.spotify.com
0.0.0.0 adnxs.com
0.0.0.0 adnxs.comadplexmedia.adk2x.com
0.0.0.0 ads-fa.spotify.com
0.0.0.0 ads.spotify.com
@sepgh
sepgh / needs.sh
Created March 28, 2020 08:13
Script that pulls/pushes all git projects in sub directories (only for ssh cloned repositories)
#!/bin/sh
### Needed packages
sudo apt install git sshpass
@sepgh
sepgh / TransactionManager.java
Last active March 5, 2020 09:21
Simple transaction manager with rollback.
com.github.gist.sepehrgh.transactions;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class TransactionManager {
private List<Transaction> transactions = new ArrayList<>();
private volatile boolean started = false;