Skip to content

Instantly share code, notes, and snippets.

@orfeomorello
orfeomorello / app.py
Created February 8, 2024 15:04
Stable Diffusion Turbo example for Intel Arc A770 running with IPEX (intel extension for pytorch)
from diffusers import AutoPipelineForText2Image, DPMSolverMultistepScheduler, AutoencoderKL
import torch
import intel_extension_for_pytorch as ipex
# Initialize LoRA model and weights
#lora_model_id = "Linaqruf/style-enhancer-xl-lora"
#lora_filename = "style-enhancer-xl.safetensors"
#FOR REAL PHOTO AND ART
@orfeomorello
orfeomorello / how-to-compile-raspberry.txt
Created October 20, 2017 15:35
Best Compilation Flags for Raspberry
If you have Raspberry 2 (V1.1): Broadcom BCM2836 ARMv7 Quad Core 32bit Processor, running at 900MHz.
./configure CFLAGS="-Ofast -mtune=cortex-a7 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -ffast-math" CXXFLAGS="-Ofast -mtune=cortex-a7 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -ffast-math"
If you have Raspberry 3
./configure CFLAGS="-Ofast -mtune=cortex-a53 -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -ffast-math" CXXFLAGS="-Ofast -mtune=cortex-a53 -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -ffast-math"
Launch the "make" command to force the code to compile always
@orfeomorello
orfeomorello / functions.php
Last active May 21, 2022 19:06
Customize Wordpress Profile
function remove_personal_options(){
echo '<script type="text/javascript">jQuery(document).ready(function($) {
$(\'form#your-profile > h2:first\').remove(); // remove the "Personal Options" title
$(\'form#your-profile tr.user-rich-editing-wrap\').remove(); // remove the "Visual Editor" field
$(\'form#your-profile tr.user-admin-color-wrap\').remove(); // remove the "Admin Color Scheme" field
$(\'form#your-profile tr.user-comment-shortcuts-wrap\').remove(); // remove the "Keyboard Shortcuts" field
/* How to add additional field in user profile add-edit in wordpress start */
add_action( 'show_user_profile', 'custom_user_fields' );
add_action( 'edit_user_profile', 'custom_user_fields' );
add_action( "user_new_form", "custom_user_fields" );
function custom_user_fields( $user )
{
$user_fb_link = get_the_author_meta( 'user_fb_link', $user->ID);
$user_gender = get_the_author_meta( 'user_gender', $user->ID);
?>
<h3><?php _e("Custom User information", "blank"); ?></h3>
<?php
/*
Plugin Name: Simplify Post Edit List
Description: Show only the author's posts in the edit list
Version: 0.1
License: GPL
Author: Sarah Gooding
*/
function mypo_parse_query_useronly( $wp_query ) {
package com.sample;
import android.app.Activity;
import android.os.Bundle;
import com.beardedhen.androidbootstrap.TypefaceProvider;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:components="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
@orfeomorello
orfeomorello / server.js
Created September 18, 2015 08:07
Simple Node.js web server available on port 8181
var connect = require('connect');
var http = require('http');
var app = connect();
var compression = require('compression')
app.use(compression())
var static = require('serve-static');
app.use(static(__dirname + "/httpdocs"));
@orfeomorello
orfeomorello / gist:8182024
Created December 30, 2013 13:19
Return HTML content as a string, given URL. (Cross-site)
<script type="text/javascript">
var your_url = 'http://www.example.com';
</script>
<script type="text/javascript" src="jquery.min.js" ></script>
<script type="text/javascript">
// jquery.xdomainajax.js ------ from padolsey
jQuery.ajax = (function(_ajax){
@orfeomorello
orfeomorello / twitter_trending_cities.html
Created August 31, 2011 20:29
Twitter trend cities example