#!/usr/bin/env python3 | |
# | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
# | |
# amdgpu_metrics.py decode amdgpu metrics from sysfs | |
# Copyright (C) 2021 leuc | |
# | |
# This program is free software: you can redistribute it and/or modify it under the | |
# terms of the GNU Affero General Public License as published by the Free Software | |
# Foundation, either version 3 of the License, or (at your option) any later |
import math | |
from math import cos, sin, ceil, floor | |
import numpy as np | |
from numpy import arcsin | |
from numpy.linalg import norm | |
from .graph_utils import plot_duo, plot_multiple, plot_xy | |
class FlightModel: | |
def __init__(self): | |
""" |
print("UPDATE AUG 2023: this script is beyond old and broken") | |
print("You may find interesting and more up to date resources in the comments of the gist") | |
exit() | |
from slacker import Slacker | |
import json | |
import argparse | |
import os | |
# This script finds all channels, private channels and direct messages |
import random | |
import urllib | |
import urllib2 | |
import soundcloud | |
import subprocess | |
from pydub import AudioSegment | |
def get_track(client_id, sc_url): | |
client = soundcloud.Client(client_id=client_id) | |
track = client.get('/resolve', url=sc_url) |
8 REM MINNESOTA EDUCATIONAL COMPUTING CONSORTIUM STAFF | |
9 REM PROGRAMMING REVISIONS BY DON RAWITSCH - 1975 | |
11 REM CURRENT VERSION - 3/27/75 | |
15 REM **FOR THE MEANING OF THE VARIABLES USED, LIST LINES 4900-4960** | |
25 PRINT "DO YOU NEED INSTRUCTIONS (YES/NO)"; | |
30 DIM C$[5] | |
35 INPUT C$ | |
40 IF C$="NO" THEN 400 | |
45 PRINT LIN(2) | |
59 REM ***INSTRUCTIONS*** |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
///////////////////////////////////////////////////////// | |
// Copied from http://www.alecjacobson.com/weblog/?p=3816 | |
///////////////////////////////////////////////////////// | |
#import <Foundation/Foundation.h> | |
#import <Cocoa/Cocoa.h> | |
#import <unistd.h> | |
BOOL copy_to_clipboard(NSString *path) | |
{ | |
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage | |
NSImage * image; |
"""Demo of streaming requests with Tornado. | |
This script features a client using AsyncHTTPClient's body_producer | |
feature to slowly produce a large request body, and two server | |
handlers to receive this body (one is a proxy that forwards to the | |
other, also using body_producer). | |
It also demonstrates flow control: if --client_delay is smaller than | |
--server_delay, the client will eventually be suspended to allow the | |
server to catch up. You can see this in the logs, as the "client |
If your application demands marshaling to JSON or another serialiazation format using Go, it can be tempting to design your structures to be cleanly serializable – often to the detriment of the implementation.
You might find yourself exporting variables you shouldn't be exporting, or creating elaborate ways to prevent mutability of attributes you care about.
If you find yourself doing this, stop, and consider the separation of concerns. JSON is a representation of your structure, and should not be directly tied to its underlying implementation, unless it's convenient. Although it's a bit more expensive, consider creating custom marshaling functions and generating one-off structs with the exact fields you need to decouple the implementation from representation.
In the following example, you don't want to export the Value
field from the Counter
struct, because it exposes your value to potentially unsafe operations (two incrementations at the same time, for example):
type Counter struct {