Skip to content

Instantly share code, notes, and snippets.

View naltun's full-sized avatar
🕊️
Free/Libre Software to the rescue

Noah naltun

🕊️
Free/Libre Software to the rescue
View GitHub Profile
@naltun
naltun / la-tricolor.sh
Last active November 10, 2022 09:53
La bandera de la Segunda República Española
#!/bin/bash
echo -ne "\e[34m"
echo -e "\e[41m \e[40m"
echo -e "\e[43m \e[40m"
echo -e "\e[45m \e[40m"
echo -ne "\e[0m"
// main.zig
const std = @import("std");
const warn = std.debug.warn;
const libcurl = @cImport(@cInclude("/usr/include/curl/curl.h"));
pub fn main() void {
var curl: *libcurl.CURL = libcurl.curl_easy_init();
var res: libcurl.CURLcode = undefined;
var url = "https://example.com";
// The code
const http = @import("http.zig");
const std = @import("std");
const warn = std.debug.warn;
const libcurl = @cImport(@cInclude("/usr/include/curl/curl.h"));
pub fn main() void {
var curl: *libcurl.CURL = libcurl.curl_easy_init();
var res: libcurl.CURLcode = undefined;
@naltun
naltun / gist:a1a305584d5f890d2f3914eece275e25
Last active January 28, 2020 16:53
My basic main.zig and Makefile
// main.zig
const std = @import("std");
const warn = std.debug.warn;
const libcurl = @cImport(@cInclude("/usr/include/curl/curl.h"));
pub fn main() void {
const curl = libcurl.curl_easy_init();
warn("Hello, World!\n");
}
[----] I, [2018-11-13T09:26:35.931230 #891:4d4a0e0] INFO -- : Started POST "/ems_cloud" for 162.220.220.27 at 2018-11-13 09:26:35 -0500
[----] I, [2018-11-13T09:26:35.936327 #891:4d4a0e0] INFO -- : Processing by EmsCloudController#create as JS
[----] I, [2018-11-13T09:26:35.936628 #891:4d4a0e0] INFO -- : Parameters: {"utf8"=>"✓", "authenticity_token"=>"removed", "button"=>"validate", "cred_type"=>"default", "name"=>"CirrusLabs [GCP]", "emstype"=>"gce", "project"=>"removed", "zone"=>"default", "service_account"=>"{\r\n \"type\": \"service_account\",\r\n \"project_id\": \"removed\",\r\n \"private_key_id\": \"removed\",\r\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nREMOVED==\\n-----END PRIVATE KEY-----\\n\",\r\n \"client_email\": \"887120188021-compute@developer.gserviceaccount.com\",\r\n \"client_id\": \"109022016564124963346\",\r\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\r\n \"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\r\n \"auth_provider_x509_cert_ur
@naltun
naltun / example.sh
Created August 2, 2018 16:01
find + sed
#!/bin/bash
find . -type f exec sed -i -e 's/firstString/secondString/g' {} \;
----------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 1.1 GB 00:01:48
Running transaction check
Running transaction test
Transaction check error:
file /usr/lib64/collectd/disk.so conflicts between attempted installs of collectd-disk-5.8.0-3.el7.x86_64 and collectd-5.8.0-3.el7.x86_64
file /usr/lib64/collectd/write_http.so conflicts between attempted installs of collectd-write_http-5.8.0-3.el7.x86_64 and collectd-5.8.0-3.el7.x86_64
@naltun
naltun / test.sh
Created February 28, 2018 15:00
installing docker on Antergos
yes | pacman -Syu docker
systemctl start docker.socket
systemctl start docker.service
# RETURNS:
#Job for docker.service failed because the control process exited with error code.
# See "systemctl status docker.service" and "journalctl -xe" for details.
journalctl -xe
# Feb 28 09:58:39 systemd[1]: docker.service: Start request repeated too quickly.
# Feb 28 09:58:39 systemd[1]: docker.service: Failed with result 'exit-code'.
# Feb 28 09:58:39 systemd[1]: Failed to start Docker Application Container Engine.
PHP Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
// My connection method
$connection = new mysqli($host, $dbuser, $pass, $dbname, $port);
var_dump($connection); // long live the connection errors
mysqli_close($connection);
@naltun
naltun / turn_based.rb
Last active December 12, 2017 14:12 — forked from CodePint/turn_based.rb
##Turn based ruby game
=begin
GOAL
Write a simple game that allows the user and the computer to take turns selecting moves to use against each other.
Both the computer and the player should start out at the same amount of health (such as 100),
and should be able to choose between the three moves:
The first move should do moderate damage and has a small range (such as 18-25).