Skip to content

Instantly share code, notes, and snippets.

View adabru's full-sized avatar
💭
Good luck!

Adam Brunnmeier adabru

💭
Good luck!
View GitHub Profile
#include <string_view>
#include <exception>
#include <assert.h>
using namespace std::literals;
struct guid
{
uint32_t Data1;
uint16_t Data2;
@sgdan
sgdan / gzip.kts
Last active May 24, 2024 10:10
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun gzip(content: String): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(content) }
return bos.toByteArray()
@tanaikech
tanaikech / submit.md
Last active June 25, 2024 04:40
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@brettinternet
brettinternet / check-git-2.sh
Created July 6, 2017 23:54
Check if directory is a git repo or not
# from https://stackoverflow.com/questions/2180270/check-if-current-directory-is-a-git-repository
[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1
@sheharyarn
sheharyarn / mouse_control.py
Last active June 27, 2022 20:23
Control your Mouse using your Eye Movement
import zmq
from pymouse import PyMouse
#mouse setup
m = PyMouse()
x_dim, y_dim = m.screen_size()
#network setup
context = zmq.Context()
socket = context.socket(zmq.SUB)
@mcleonard
mcleonard / vector.py
Last active February 22, 2024 12:30
A vector class in pure python.
import math
class Vector(object):
def __init__(self, *args):
""" Create a vector, example: v = Vector(1,2) """
if len(args)==0: self.values = (0,0)
else: self.values = args
def norm(self):
""" Returns the norm (length, magnitude) of the vector """