Skip to content

Instantly share code, notes, and snippets.

View rorhug's full-sized avatar
📀
out on dvd

Rory Hughes rorhug

📀
out on dvd
View GitHub Profile
@rorhug
rorhug / recase-hasura.mjs
Created February 17, 2021 13:55
Hasura - Change casing of build in fields and columns to camel case
// Run this to set the graphql exposed name for columns and built-in hasura graphql action to
// Afterwards run metadata export as the metadata set into the server does not write back out through docker to local file system
// `npx hasura --project ../hasura metadata export`
import { getIntrospectionQuery } from 'graphql'
import http from 'http'
import url from 'url'
import fs from 'fs'
import dotenv from 'dotenv'
import fetch from 'node-fetch'
#!/bin/bash
# Script: my-pi-temp.sh
# Purpose: Display the ARM CPU and GPU temperature of Raspberry Pi 2/3
# Author: Vivek Gite <www.cyberciti.biz> under GPL v2.x+
# -------------------------------------------------------
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "$(date) @ $(hostname)"
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"
#include <stdio.h>
#include <stdlib.h>
#include <xmmintrin.h>
#define SIZE 600
float rgb_sum_product(float * pixels) {
float sum_red = 0.0, sum_green = 0.0, sum_blue = 0.0;
for (int i = 0; i < SIZE - 3; i += 3) {
sum_red = sum_red + pixels[i];
// Fig. 12.3: figl2_03.c
// Inserting and deleting nodes in a list
#include <stdio.h>
#include <stdlib.h>
struct listNode {
char data;
struct listNode *nextPtr;
@rorhug
rorhug / create_submission.rb
Created February 4, 2016 21:59
Create c submission zips for college
#!/usr/bin/env ruby
require 'fileutils'
require 'zip'
# ====== INSTRUCTIONS ====== #
# Stick this script in the folder with your programming set folders (s1, s2 etc.)
# Run `gem install rubyzip`. This will allow us to zip things
# Change the constants below and execute with ./create_submission.rb
# ====== CHANGE THESE ====== #
import java.util.Scanner;
public class TriangularStars {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner( System.in );
String inputString="";
do {
System.out.print("How many star&triangle number do you want? (or 'quit')");
input = new Scanner( System.in );
@rorhug
rorhug / rob.c
Created December 8, 2015 14:43
for the user to input a number(Z), to place that number in a pointer and to print out the pointer outside the function
#include <stdio.h>
// This shouldn't return anything as it's writing the value to the pointer instead
void scan_int_into_pointer(int * z) // it receives a pointer to an int as an argument
{
printf("enter value=");
scanf("%d", z); // Note: no & because z is already a pointer
// Note: No return value...
}
@rorhug
rorhug / dokku_pg
Created October 19, 2014 12:15
Dokku postgres installation error
# dokku plugins-install
gpg: keyring `/tmp/tmpupqa1nqp/secring.gpg' created
gpg: keyring `/tmp/tmpupqa1nqp/pubring.gpg' created
gpg: requesting key C300EE8C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpupqa1nqp/trustdb.gpg: trustdb created
gpg: key C300EE8C: public key "Launchpad Stable" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Sending build context to Docker daemon 145.4 kB
@rorhug
rorhug / music.js
Created August 24, 2014 08:39
Bayan music
// SETTINGS
var input = "rsa ecde srgu yhgr bv rsa ecde srgu yhgr bv hybtg ser erv";
input += " hybtg iii r hybtg ser erv tvr rrr rvgres rrr rvg rrr rvgres ";
input += "ggg rgh grs sxebbe cuuuhbgres grs sxebbe cbbbgvrsai";
var TIME_INTERVAL = 300;
// Add jquery
var script = document.createElement('script');
script.src = 'http://code.jquery.com/jquery-1.11.0.min.js';
script.type = 'text/javascript';
/var/folders/2m/1tctt7mj4lzbq_qzj5dtltr40000gn/T/ruby-build.20140818110316.52342 ~
HTTP/1.1 200 OK
Content-Type: binary/octet-stream
Content-Length: 15092388
Connection: keep-alive
Date: Mon, 30 Jun 2014 03:05:59 GMT
Last-Modified: Fri, 23 May 2014 08:34:00 GMT
ETag: "e57fdbb8ed56e70c43f39c79da1654b2"
Accept-Ranges: bytes
Server: AmazonS3