Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Kyu's full-sized avatar
😜
I like doing shit

Precious Kyu

😜
I like doing shit
View GitHub Profile
@Kyu
Kyu / index.js
Last active November 22, 2016 13:19
// from https://github.com/izy521/discord.io/blob/master/lib/index.js
import requests
from bs4 import BeautifulSoup
s = requests.session()
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'}
url = 'http://blocgame.com'
data = {'username': 'USERNAME', 'password': 'PASSWORD', 'login': ''}
s.headers['User-Agent'] = headers['User-Agent']
@Kyu
Kyu / Bloc-Alliance-Crawler.py
Last active May 15, 2017 20:00
Crawls Bloc Alliances for Economy and Military info.
from bs4 import BeautifulSoup
import aiohttp
import asyncio
from datetime import datetime
import csv
loop = asyncio.get_event_loop()
client = aiohttp.ClientSession(loop=loop)
HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0'}
BLOC = 'http://blocgame.com'
@Kyu
Kyu / file-search.py
Created December 16, 2017 18:12
searches files
import os
def search(path, query):
results = []
q = query.lower()
for root, dirs, files in os.walk(path):
for file in files:
if q in file.lower():
results.append(os.path.join(root, name))
for ls in dirs:
#from: https://stackoverflow.com/a/26494912
$colItems = Get-ChildItem $startFolder | Where-Object {$_.PSIsContainer -eq $true} | Sort-Object
foreach ($i in $colItems)
{
$subFolderItems = Get-ChildItem $i.FullName -recurse -force | Where-Object {$_.PSIsContainer -eq $false} | Measure-Object -property Length -sum | Select-Object Sum
$i.FullName + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"
}
@Kyu
Kyu / file-names.py
Created January 2, 2018 10:26
Outputs all file names in dir to file
import os
path = os.getcwd()
for root, dirs, files in os.walk(path):
with open('names.txt', 'w') as f:
f.writelines([i +'\n' for i in files])
@Kyu
Kyu / sqlite-to-mysql.py
Created January 2, 2018 15:19
converts sqlite to mysql
#Incomplete
from sqlalchemy import (
create_engine,
MetaData,
Table
)
from sqlalchemy.orm import sessionmaker
sqlite_engine = create_engine('sqlite:///main.db', echo=True)
@Kyu
Kyu / mp3-to-m4r.bat
Created May 23, 2018 01:22 — forked from TheZoc/mp3-to-m4r.bat
Convert a MP3 file to an Apple iPhone's ringtone file (M4R), using FFMPEG.
@echo off
rem =====================================================
rem Converts a MP3 file to a M4R file using ffmpeg.
rem Usage: Drop a MP3 file at the top of this batch file.
rem =====================================================
rem %~f1 = Full File Path, with drive letter
rem %~p1 = Drive Letter
rem %~p1 = Path Only
rem %~n1 = File Name
@Kyu
Kyu / CMakeLists.txt
Created July 11, 2019 19:23
Cmake Config for SDL2
cmake_minimum_required(VERSION 3.13)
project(ProjectName)
set(CMAKE_CXX_STANDARD 14)
add_executable(ProjectName main.cpp)
set(prefix "PATH_TO_MINGW_OR_SOMETHING_ELSE_WITH_SDL2_DEV_FILES_PASTED_INTO_IT_PATH_CANNOT_HAVE_SPACES")
#uses i686 32bit minwgw32
#include <iostream>
using namespace std;
int power(int a, int b) {
int pow = 1;
if (b == 0) {
return pow;
}