Skip to content

Instantly share code, notes, and snippets.

@sebastiancarlos
sebastiancarlos / sway-swap-workspaces.bash
Last active November 26, 2023 05:09
sway-swap-workspaces.bash
#!/usr/bin/env bash
# All my gist code is licensed under the MIT license.
# Add this to your PATH
green='\033[0;32m'
red='\033[0;31m'
bold='\033[1m'
reset='\033[0m'
@cb372
cb372 / riscv.md
Last active April 9, 2025 19:53
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active April 9, 2025 09:08
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@FedericoPonzi
FedericoPonzi / socket_portable.c
Last active March 8, 2024 01:36
C sockets portable in windows/linux example
// As seen on http://www.di.uniba.it/~reti/LabProRete/Interazione(TCP)Client-Server_Portabile.pdf
#if defined WIN32
#include <winsock.h>
#else
#define closesocket close
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdio.h>
@Nzen
Nzen / readme.md
Last active August 15, 2024 09:15
JavaDoc dark theme

What is this?

A css to replace the light version that Oracle serves. I like dark themes for the webpages that I read. All that must be done is change the stylesheet link in the pages you use or to nest the pages at the appropriate level.

@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@holgero
holgero / SignalHandler.java
Created December 1, 2012 16:03
Catch SIGTERM in java
package de.holger_oehm.jvm.signal;
public final class SignalHandler {
public static void main(final String[] args) throws InterruptedException {
final SignalHandler instance = new SignalHandler();
System.out.println(instance);
Thread.sleep(20000L);
}
@lucastex
lucastex / Handler.java
Created April 13, 2011 17:38
Reading files from Amazon S3 directly in a java.net.URL object.
package sun.net.www.protocol.s3;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import org.jets3t.service.ServiceException;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;