This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# note: current working directory ($PWD) assumed to be directory containing a static podman installation | |
# replace all occurrences of /path/to/static/podman with actual value of $PWD | |
cp storage.conf "$HOME/.config/containers/storage.conf" | |
PATH="$PWD/usr/local/bin:$PATH" ./usr/local/bin/podman \ | |
--conmon "$PWD/usr/local/lib/podman/conmon" \ | |
--runtime runc \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* tiny_IRremote | |
* Version 0.2 July, 2016 | |
* Christian D'Abrera | |
* Fixed what was originally rather broken code from http://www.gammon.com.au/Arduino/ | |
* ...itself based on work by Ken Shirriff. | |
* | |
* This code was tested for both sending and receiving IR on an ATtiny85 DIP-8 chip. | |
* IMPORTANT: IRsend only works from PB4 ("pin 4" according to Arduino). You will need to | |
* determine which physical pin this corresponds to for your chip, and connect your transmitter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols | |
# wayland-scanner is a tool which generates C headers and rigging for Wayland | |
# protocols, which are specified in XML. wlroots requires you to rig these up | |
# to your build system yourself and provide them in the include path. | |
xdg-shell-protocol.h: | |
wayland-scanner server-header \ | |
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ | |
xdg-shell-protocol.c: xdg-shell-protocol.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hello { | |
public static void main(String args[]) { | |
System.out.println("Hello World!"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Performs an AJAX (XMLHttpRequest) request where | |
- method is the HTTP verb to use (e.g. 'POST') | |
- dest is the destination endpoint path (e.g. '/api/endpoint') | |
- type concerns how the response should be handled (e.g. 'json') | |
- success is callback function that takes a response body | |
- error is a callback funtion that takes a full error response object | |
- data is data to send to the server (as in 'POST') | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class GeneralAverage { | |
public static int mean(int a, int b) { | |
return ((a<0) ^ (b<0)) ? (a + b) / 2 : (a%2 == 0 || b%2 == 0 ? a/2 + b/2 : a/2 + b/2 + ((a < 0) ? -1 : 1)); | |
} | |
public static void main(String[] args) { | |
Random rand = new Random(); | |
int a = Integer.MAX_VALUE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple systemd unit file for shadowsocks server (python version) | |
# See tutorial at shadowsocks' repo master: https://github.com/shadowsocks/shadowsocks/tree/master | |
# | |
# Prerequisites | |
# a) installed shadowsocks server in /usr/local/bin (the default if done through pip) | |
# b) shadowsocks server configuration json file in /etc/shadowsocks.json | |
# c) a user called "shadowsocks" that the server will run as | |
# | |
# Remember to place this file in /etc/systemd/systemd and then enable this unit with "systemctl enable shadowsocks.service" to have it start at boot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.steadystate.css.parser.CSSOMParser; | |
import com.steadystate.css.parser.SACParserCSS3; | |
import org.w3c.css.sac.InputSource; | |
import org.w3c.dom.css.CSSRule; | |
import org.w3c.dom.css.CSSRuleList; | |
import org.w3c.dom.css.CSSStyleSheet; | |
import java.io.IOException; | |
import java.io.StringReader; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sets the POSIX group for a file, given the file's path as a string and the target group name. | |
*/ | |
public static void reassignFileGroup(String filePath, String groupName) throws IOException { | |
Path path = Paths.get(filePath); | |
PosixFileAttributeView view = Files.getFileAttributeView(path, PosixFileAttributeView.class); | |
UserPrincipalLookupService lookup = path.getFileSystem().getUserPrincipalLookupService(); | |
GroupPrincipal group = lookup.lookupPrincipalByGroupName(groupName); | |
view.setGroup(group); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright 2016 icasdri | |
# | |
# 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, |